<?php

namespace AdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\Table(name="admin", options={"comment":"管理员表"})
 * @ORM\Entity
 */
class Admin
{
    /**
     * @var string
     *
     * @ORM\Column(name="id", type="string")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="CUSTOM")     
     * @ORM\CustomIdGenerator(class="RedUnicorn\SymfonyKernel\Doctrine\SortIdGenerator")
     */
    private $id;

    /**
     * @var string
     *
     * @Assert\NotBlank(message="请填写管理员名称")
     * @Assert\Length(max="30",maxMessage="管理员名称最大长度为30")
     * @ORM\Column(name="name", type="string", length=30, options={"comment":"管理员名称"})
     */
    private $name;

    /**
     * @var string
     * @Assert\NotBlank(message="请填写登陆账号")
     * @Assert\Length(max="30",maxMessage="登陆账号最大长度为30")
     * @Assert\Regex(pattern="/^\w{6,30}$/", message="登录帐号格式错误")
     *
     * @ORM\Column(name="account", type="string", length=30, options={"comment":"登陆账号"})
     */
    private $account;

    /**
     * @var string
     *
     * @ORM\Column(name="password", type="string", length=40, options={"comment":"密码"})
     */
    private $password;

    /**
     * @var string
     *
     * @ORM\Column(name="salt", type="string", length=4, options={"comment":"盐值"})
     */
    private $salt;

    /**
     * @var boolean
     *
     * @ORM\Column(name="is_disable", type="boolean", options={"comment":"是否禁用", "default":"0"})
     */
    private $isDisable = 0;

    /**
     * @var boolean
     *
     * @ORM\Column(name="is_del", type="boolean", options={"comment":"是否删除", "default":"0"})
     */
    private $isDel = 0;

    /**
     * @var boolean
     *
     * @ORM\Column(name="is_built", type="boolean", options={"comment":"是否内置", "default":"0"})
     */
    private $isBuilt = 0;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="create_at", type="datetime", options={"comment":"创建时间"})
     */
    private $createAt;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="update_at", type="datetime", nullable=true, options={"comment":"更新时间"})
     */
    private $updateAt;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="last_login_at", type="datetime", nullable=true, options={"comment":"最后登陆时间"})
     */
    private $lastLoginAt;

    /**
     * @var string
     *
     * @ORM\Column(name="last_login_ip", type="string", nullable=true, length=10, options={"comment":"最后登陆IP"})
     */
    private $lastLoginIp;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     *
     * @return Admin
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set account
     *
     * @param string $account
     *
     * @return Admin
     */
    public function setAccount($account)
    {
        $this->account = $account;

        return $this;
    }

    /**
     * Get account
     *
     * @return string
     */
    public function getAccount()
    {
        return $this->account;
    }

    /**
     * Set password
     *
     * @param string $password
     *
     * @return Admin
     */
    public function setPassword($password)
    {
        $this->password = $password;

        return $this;
    }

    /**
     * Get password
     *
     * @return string
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set salt
     *
     * @param string $salt
     *
     * @return Admin
     */
    public function setSalt($salt)
    {
        $this->salt = $salt;

        return $this;
    }

    /**
     * Get salt
     *
     * @return string
     */
    public function getSalt()
    {
        return $this->salt;
    }

    /**
     * Set isDisable
     *
     * @param boolean $isDisable
     *
     * @return Admin
     */
    public function setIsDisable($isDisable)
    {
        $this->isDisable = $isDisable;

        return $this;
    }

    /**
     * Get isDisable
     *
     * @return boolean
     */
    public function getIsDisable()
    {
        return $this->isDisable;
    }

    /**
     * Set isDel
     *
     * @param boolean $isDel
     *
     * @return Admin
     */
    public function setIsDel($isDel)
    {
        $this->isDel = $isDel;

        return $this;
    }

    /**
     * Get isDel
     *
     * @return boolean
     */
    public function getIsDel()
    {
        return $this->isDel;
    }

    /**
     * Set isBuilt
     *
     * @param boolean $isBuilt
     *
     * @return Admin
     */
    public function setIsBuilt($isBuilt)
    {
        $this->isBuilt = $isBuilt;

        return $this;
    }

    /**
     * Get isBuilt
     *
     * @return boolean
     */
    public function getIsBuilt()
    {
        return $this->isBuilt;
    }

    /**
     * Set createAt
     *
     * @param \DateTime $createAt
     *
     * @return Admin
     */
    public function setCreateAt($createAt)
    {
        $this->createAt = $createAt;

        return $this;
    }

    /**
     * Get createAt
     *
     * @return \DateTime
     */
    public function getCreateAt()
    {
        return $this->createAt;
    }

    /**
     * Set updateAt
     *
     * @param \DateTime $updateAt
     *
     * @return Admin
     */
    public function setUpdateAt($updateAt)
    {
        $this->updateAt = $updateAt;

        return $this;
    }

    /**
     * Get updateAt
     *
     * @return \DateTime
     */
    public function getUpdateAt()
    {
        return $this->updateAt;
    }

    /**
     * Set lastLoginAt
     *
     * @param \DateTime $lastLoginAt
     *
     * @return Admin
     */
    public function setLastLoginAt($lastLoginAt)
    {
        $this->lastLoginAt = $lastLoginAt;

        return $this;
    }

    /**
     * Get lastLoginAt
     *
     * @return \DateTime
     */
    public function getLastLoginAt()
    {
        return $this->lastLoginAt;
    }

    /**
     * Set lastLoginIp
     *
     * @param string $lastLoginIp
     *
     * @return Admin
     */
    public function setLastLoginIp($lastLoginIp)
    {
        $this->lastLoginIp = $lastLoginIp;

        return $this;
    }

    /**
     * Get lastLoginIp
     *
     * @return string
     */
    public function getLastLoginIp()
    {
        return $this->lastLoginIp;
    }

    public function __toString()
    {
        return (string)$this->getId();
    }
}
